﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Trangtrai.Controller.Authorized;
using Trangtrai.Controller.Global;
using Trangtrai.Model;
namespace Trangtrai
{
    public partial class Index : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //loginPop.
        }
        protected void lg_Click(object sender, EventArgs e)
        {

        }

        protected void btOK_Click(object sender, EventArgs e)
        {
            String sessionID = "";
            int roleID = new LoginController().checkLoginStatus(tbLogin.Text,tbPassword.Text);
            switch (roleID)
            {
                case Define.ADMIN_PER:
                    sessionID = "admin";
                    Response.Redirect("Default.aspx");
                    break;
                case Define.DOITRUONG_PER:
                    sessionID = "doitruong";
                    break;
                case Define.DOIVIEN_PER:
                    sessionID = "doivien";
                    break;
                case Define.KIEMSOAT_PER:
                    sessionID = "kiemsoat";
                    break;
                case Define.KY_THUAT_PER:
                    sessionID ="kythuat";
                    break;
            }
            Session[sessionID] = tbLogin.Text;                   
        }
        protected void btCancel_Click(object sender, EventArgs e)
        {

        }
    }
}
